var vm = new Vue({
    el: "#app",
    data: {
        taskName: '',
        taskList: []
    },
    methods: {
        addList() {
            // console.log(1);
            var obj = {
                id: this.taskList.length + 1, name: this.taskName, status: false
            };
            this.taskList.push(obj);//将新增的任务尾插到taskList数组中
            // console.log(this.taskList.length);
            this.taskName = ''//将搜索内容清空
        },
        changStatus(item) {
            item.status = !item.status;//更新当前的任务状态
        },
        remove(index) {
            this.taskList.splice(index,1);//删除元素
            // console.log(index);
        }
    },
    computed: {
        unFinishCount() {
            var arr = this.taskList.filter((item) => {
                return item.status == false;
            })
            return arr.length;
        }
    }
})